import { getData, ifWorldData, bindData } from "../Data/dataBase";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    countLabel: cc.Label = null;

    private count:number = 0;

    onLoad(){
        var worldData:ifWorldData = getData("WORLD_DATA");
        this.count = worldData.killCount;
        this.refresh();

        bindData("WORLD_DATA", "KILL_COUNT", function(killCount){
            this.count = killCount
            this.refresh();
        }.bind(this), this);
    }

    refresh(){
        this.countLabel.string  = "杀敌：" + this.count;
    }

}
